<#include '/admin/header.html' >
	<script type="text/javascript" src="${ctx}/core/admin/js/Adv.js"></script>
<div class="admin-main">
	<form id="advform">
			<table class="layui-table site-table table-hover" width="100%" id="bonusdata">
				<thead>
					<tr>
					     <th><input type='checkbox'  class='btn-checkall fly-checkbox' id='selected-all' ></th>
						<th>编号</th>
						<th>红包序号</th>
						<th>红包类型</th>
						<th>订单号</th>
						<th>创建时间</th>
						<th>使用会员</th>
						<th>使用开始时间</th>
						<th>使用结束时间</th>
						<th>使用时间</th> 
					</tr>
				</thead>
			</table>
	</form>
	<div id="divdia" style="display: none;"></div>
</div>

<script>
var table;
$(function(){
	
	 table = $('#bonusdata').DataTable({
		"language": {
	        "url": "${staticserver}/media/zh_CN.txt"
	    },
	    "processing": true,
	    "serverSide": true,
	    "ordering": false,
	    "searching": false,
	    "lengthChange": false,
	    ajax: {
	        //指定数据源
	        type:"post",
	        url: '${ctx}/shop/admin/bonus/list-json.do?typeid=${typeid}&send_type=${send_type}',
	    },
	    columns: [ //定义列
            {"data": function (obj) {
                return '<input type="checkbox" name="bonus_id" class="fly-checkbox" value' + obj.bonus_id + '>';
            		}},      
	        
	        {data: null,"render":function(data,type,row){
	        	if(data.bonus_id==null){
	        	    return "";
	        	}else{
                    return data.bonus_id;  	        		
	        	}
	        }},
	        {data: null,"render":function(data,type,row){
	        	if(data.bonus_sn==null){
	        	    return "";
	        	}else{
                    return data.bonus_sn;  	        		
	        	}
	        }},
	        {data: null,"render": function(data,type,row) {
	        	var val;
	        	if(data.send_type == 0){
  	        		val = "按用户发放";
  	        	}
  	        	if(data.send_type == 1){
  	        		val = "按商品发放";
  	        	}
  	        	if(data.send_type == 2){
  	        		val = "按订单金额发放";
  	        	}
  	        	if(data.send_type == 3){
  	        		val = "线下发放的红包";
  	        	}
	    		if (data.send_type == null) {
	    			val = "";
	    		}
	    		return val;
	       	}},
	        {data: "order_sn"},
	        {data:  null,"render": function(data, type, row) {
	        	if(data.create_time==null){
	        		return "";
	        	}else{
	        		return getFormatDateByLong(data.create_time, "yyyy-MM-dd hh:mm:ss");
	        	} 
	       	}},
	        {data: "member_name"},
	        {data: null,"render": function(data, type, row) {
	        	if(data.use_start_date==null){
	        		return " ";
	        	}else{
	        		return getFormatDateByLong(data.use_start_date, "yyyy-MM-dd hh:mm:ss");
	        	}
	       	}},
	        {data: null,"render": function(data, type, row) {
	        	if(data.use_end_date==null){
	        		return " ";
	        	}else{
	        		return getFormatDateByLong(data.use_end_date, "yyyy-MM-dd hh:mm:ss");
	        	}
	       	}},
	        {data: null,"render": function(data, type, row) {
	        	if(data.used_time==null){
	        		return " ";
	        	}else{
	        		return getFormatDateByLong(data.used_time, "yyyy-MM-dd hh:mm:ss");
	        	}
	       	}}
	     ]
	});
	 
});

</script>
<#include '/admin/footer.html' >
